<?
require_once('init.php');
if(!isset($_GET[id]) || intval($_GET[id])<1)
	header("location:".baselink);
else
{
	$id=$_GET[id];
	$data=array(
		"time"=>time(),
		"ip" => $_SERVER['REMOTE_ADDR'],
		"parent" => $id
		);
	insert($data,"logs_quangcao");
	$query=query("select url from link_quangcao where id = $id");
	$f=fetch($query);
	if($f['url']!="")
		header("location:".$f['url']);
	else
		header("location:".baselink);
}

print_r(fetch(query("select * from post limit 1")));

?>